package com.slz3.business.module.systemManagement.sysPermissions.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.systemManagement.sysPermissions.domain.SysPermissions;
import com.slz3.business.module.systemManagement.sysPermissions.domain.SysPermissionsFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class SysPermissionsTransactionalServiceImpl implements SysPermissionsTransactionalService {

    @Override
    public SysPermissions modify(SysPermissions sysPermissionsNew) {
        Repositorys.sysPermissions.test();
        Repositorys.sysPermissions.save(SysPermissionsFactory.initBaseFields());
        System.err.println(1/0);
        sysPermissionsNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.sysPermissions.saveAndFlush(sysPermissionsNew);
    }

    @Override
    public List<SysPermissions> batchModify(List<SysPermissions> sysPermissionsList) {
        return Repositorys.sysPermissions.saveAll(sysPermissionsList);
    }
}
